#include "stdafx.h"
#include "Syncronizer.h"
#include "SyncronizationMessage.h"

Syncronization::Syncronizer* Syncronization::Syncronizer::ourInstance = NULL;

void Syncronization::Syncronizer::Create()
{
	ourInstance = new Syncronizer;
}

void Syncronization::Syncronizer::Destroy()
{
	delete ourInstance;
	ourInstance = NULL;
}

void Syncronization::Syncronizer::Send(Message* aMessage)
{
	ourInstance->myMessageQueue.Add(aMessage);
}

Utils::GrowingArray<Syncronization::Message*>& Syncronization::Syncronizer::GetMessages()
{
	return ourInstance->myMessageQueue;
}

void Syncronization::Syncronizer::ClearMessages()
{
	ourInstance->myMessageQueue.DeleteAll();
}

Syncronization::Syncronizer::Syncronizer()
{
	myMessageQueue.Init(50, 50);
	DL_PRINT("Syncronizer created");
}

Syncronization::Syncronizer::~Syncronizer()
{
	myMessageQueue.DeleteAll();
}